
class UserHelper{

    static getCachedUserInfo = (username?:string)=> {
        return JSON.parse(localStorage.getItem(UserHelper.userInfoKey())||"{}");
    }
    
    static updateCachedUserInfo = (username:string,userInfo:string) => {
        localStorage.setItem(UserHelper.userInfoKey(),JSON.stringify(userInfo));
    }
    
    static removeCachedUserInfo = (username?:string) => {
        localStorage.removeItem(UserHelper.userInfoKey());
    }
    
    static userInfoKey = (username?:string) => {
        return `k_userInfo_cache`;
    }
}

export default UserHelper;